#include <iostream>

using namespace std;
struct ListNode

{

int       m_nKey;

ListNode* m_pNext;

};


int theKvalue(ListNode *p,int &k,int &num,int & key)
{
    if(p==nullptr )
    {
        num=0;   ///注意这里是0   因为当前的p是nullptr
        return 0;
    }
    theKvalue(p->m_pNext, k, num,key);
    num++;          ///注意这里 ++
    if(num==k)
    {
        key=p->m_nKey; ///
    }
    return 0;
    
}

int main()
{
int num=0;
while(cin>>num)
{
    int data=0;
    int total=num;
    int k=0;
    ListNode *L=new  ListNode;
    ListNode *L1=L;
    L->m_nKey=-9999;
    while(num-- && cin>>data)
    {
         ListNode *p=new  ListNode;
        p->m_nKey=data;
        L->m_pNext=p;   ///尾插法
        L=p;
    }
    cin>>k;
    if(k==0)
        cout<<0<<endl;
    else 
    {
        int num1=0;
        int key=0;
        theKvalue(L1,k,num1,key);
       cout<<key<<endl;
    }

    
    
}
     return 0;
    
}